#include <windows.h>
#include <string>
#include <iostream>
using namespace std;;

char* getTrunkPath()
{	
    char *buffer = new char[256];		
	int count ,tempCount, i;
	count = tempCount = i = 0;
	GetModuleFileName(NULL, buffer, MAX_PATH);

	//change '\' to '/' and count number of '/'
	while (buffer[i] != 0)
	{
		if (buffer[i] == '\\')
		{
			buffer[i] = '\/';
			count++;
		}
		i++;
	}
	cout<<buffer<<endl;

	//find and cut
	i = 0;
	while (buffer[i] != 0)
	{
		if (buffer[i] == '\/')
		{			
			if (tempCount == count - 3)
				buffer[i + 1] = NULL;
			tempCount++;
		}
		i++;
	}
	return buffer;	
}

//string getVisualPath()
//{
//	string::size_type pos = getDebugPath().find_last_of("\\/");		
//    return getDebugPath().substr( 0, pos);
//}
//
//string getTrunkPath()
//{
//	string::size_type pos = getVisualPath().find_last_of("\\/");		
//    return getVisualPath().substr( 0, pos);
//}